<template>
  <div class="container">
    <xy-table
      :api="api"
      :columns="columns"
      :param="query"
      ref="xy-table"
    >
      <template slot="addItem">
        <search-header
          :model="query"
          :on-search="onSearch"
        ></search-header>
      </template>

      <template #check="{ row }">
        <template
          :span="8"
          class="center"
          v-if="row.Status !== 1"
        >
          <el-button
            @click="toCheck(row)"
            size="mini"
            type="text"
          >{{ $language.local("审核") }}</el-button>
        </template>
        <span v-else></span>
      </template>
      <template #edit>
        <span hidden></span>
        <!-- <template v-if="row.Status === 1">
          <el-button type="text" size="mini" @click="toCheck(row)">
            {{ $language.local("代发") }}
          </el-button>
        </template>-->
      </template>
      <template #delete>
        <span></span>
      </template>
      <template #appendButton="{row}">
        <el-button
          :disabled="row.paystatus === 1"
          @click="$router.push('/invoiceApplyList')"
          type="text"
        >支付</el-button>
      </template>
    </xy-table>
  </div>
</template>

<script>
import API from "../../plugins/api";

export default {
  name: "payroll",

  data() {

    return {
      api: new API("/api/TSKSettlement/GetList"),
      columns: {
        // BusinessNo: "",
        // SPID: 0,
        // MID: 0,
        SPName: "string",
        MerchantName: "string",
        TSKSettlementType: "",
        // atime: "2021-06-29T13:36:55.763Z",
        SettlementDate: "2021-06-29T13:36:55.763Z",
        // TSKSettlementType: "string",
        // AttFile: "string",
        // otherFile: "string",
        // BusinessNo: "string",
        Amount: 0,
        // Status: 0,
        paystatus: 0,
        OpenInvoiceStatus: "",
      },
      addForm: {
        MID: "",
        BeneficiaryName: "",
        ordrId: "",
        // CanceltrxId: "",
        refundAmount: "",
        refundReason: "",
        AttFileUrl: "",
      },

      query: {
        mid: "",
        queryYM: "",
        // RechargeStatus: "",
      },
    };
  },
  created() {},
  methods: {
    onSearch(e) {
      console.log(e);
      this.$refs["xy-table"].getData(e);
    },

    toPayRefundDetail() {},
    toCheck(e) {
      console.log(e);
      this.$store.commit("setData", { TSKSettlementData: e });
      this.$router.push({
        path: "/TSKSettlementDetail",
        query: {
          id: e.Id,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped></style>
